import request from '@/utils/request'

/**
 * 字典
 */
export function getDictByCode(dictCode) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDictionary/getDictByCode',
    method: 'POST',
    data: { dictCode }
  })
}

export function queryPage(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: 'backend/giveInfo/queryPage',
    method: 'post',
    data
  })
}

/**
 * 查询详情
 * @param {*} id
 */
export function get(id) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/giveInfo/get',
    method: 'get',
    params: { id }
  })
}

/**
 * 添加福利包
 * @param {*} data
 */
export function insert4Account(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/giveInfo/insert',
    method: 'post',
    data
  })
}

/**
 * 编辑福利包
 * @param {*} data
 */
export function update4Account(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/giveInfo/update',
    method: 'post',
    data
  })
}

/**
 * 添加兑换券
 * @param {*} data
 */
export function insert4Coupon(data,t) {
	let url=t=='7'?'insertForShop':'insertForExchangeCoupon'
	return request({
		baseURL: '/API-ENTERPRISE-BACKEND/',
		url: '/backend/giveInfo/'+url,
		method: 'post',
		data
	})
}

/**
 * 编辑兑换券
 * @param {*} data
 */
export function update4Coupon(data) {
	return request({
		baseURL: '/API-ENTERPRISE-BACKEND/',
		url: '/backend/giveInfo/update',
		method: 'post',
		data
	})
}

/**
 * 删除
 * @param {*} id
 */
export function del(ids) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/giveInfo/deleteByIds',
    method: 'get',
    params: { ids }
  })
}

export function queryAccount(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: 'backend/childAccount/queryItemList',
    method: 'post',
    data
  })
}
export function queryJd(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/jdActivity/query',
    method: 'post',
    data
  })
}

/**
 * 获取优惠券列表
 * @param data
 */
export function queryCoupons(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/exchangeCoupon/query',
    method: 'post',
    data
  })
}

/**
 * 修改状态
 * @param {*} data
 */
export function updatePublishStatus(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/giveInfo/updatePublishStatus',
    method: 'post',
    data
  })
}
/**
 * 获取出金账户
 * @param {*} data 
 * @returns 
 */
export function getAcc(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/account/getExpenditureAccount',
    method: 'post',
    data
  })
}
export function getRechOne(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/recharge/getOneList',
    method: 'post',
    data
  })
}

/**
 * 获取入金账户
 * @param {*} data 
 * @returns 
 */
 export function getAccIn(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/account/getIncomeAccount',
    method: 'post',
    data
  })
 }
 export function getRech(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/recharge/getRechargeWelfare',
    method: 'post',
    data
  })
 }
 export function getJdRech(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/recharge/getRechargeJD',
    method: 'post',
    data
  })
 }
 /*
	获取商城商户信息
 */
 export function queryMerchant(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/merchantInfo/query',
    method: 'post',
    data
  })
 }
 /*
 	获取商城线下提货券
 */
 export function merchantCoupons(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/merchantInfo/queryMchntCouponListPage',
    method: 'post',
    data
  })
 }
 

